#include "qbtneditorlabel.h"

#include <QPushButton>
#include <QHBoxLayout>

#include <QMouseEvent>

using namespace SHAREDLIB;

QBtnEditorLabel::QBtnEditorLabel(SHAREDLIB::QAbstractProperty *property):
    QEditorLabel(property)
{
    this->setFocusPolicy(Qt::StrongFocus);
    QPushButton *b=new QPushButton(this);
    b->setText("...");
    b->setFixedSize(20,20);
    QHBoxLayout *l=(QHBoxLayout*)this->layout();
    l->addWidget(b);
    b->setFocusProxy(this);
    connect(b,SIGNAL(clicked()),this,SLOT(clicked()));

}

void QBtnEditorLabel::mouseDoubleClickEvent(QMouseEvent *e)
{
    if(e->button()==Qt::LeftButton)
    {
        clicked();
    }
}

QAbstractProperty *QBtnEditorLabel::getProeprty()
{
    return m_property;
}

void QBtnEditorLabel::clicked()
{
    emit btnClicked();
}
